//
//  SurpriseShopDetModel.swift
//  XiaoJingMallSwift
//
//  Created by beisheng03 on 2017/8/15.
//  Copyright © 2017年 beisheng. All rights reserved.
//

import UIKit


class SurpriseShopDetModel: NSObject {
    var complete_time = "-999"
    var od_no = "-999"
    var join_list = [SurpriseShopJoinListModel]()
    var od_count = "-999"
    var lucky_nums : String?
    var detail_url = "-999"
    var goods_image = "-999"
    var goods_name = "-999"
    var od_goods_price = "-999"
    var od_addtime = "-999"
    var od_remain_count = "-999"
    var od_buy_count = "-999"
    var od_state = "-999"
    
    var publish_time = "-999"
    var od_type = "-999"
    var buy_limit = "-999"
    var share_data : shareInfoModel?
    var app_qrimg = "-999"
    
    var od_progress = "-999"
    var prize_code = "-999"
    var goods_id = "-999"
    var have_address = "-999"
    var od_id = "-999"
    var member_name = "-999"
    var member_avatar_url = "-999"
    var buy_count = "-999"
    var publish_date = "-999"
    var countdown = "-999"

    
    
    var member_ip = "-999"
    var member_id = "-999"
    var province = "-999"

  
    
    
    init(dic : [String : AnyObject]) {
        super.init()
        
        setValuesForKeys(dic)
        
    }
    
    
    override func  setValue(_ value: Any?, forKey key: String) {
        
        if key == "share_data" {
            
            if let temp = value as? [String : AnyObject]{
                
                share_data = shareInfoModel(dic:temp )
                
            }
            
        } else if key == "join_list" {
            
            if let temp = value as? [[String : AnyObject]]{
                
                for dic in temp {
                    
                    join_list.append(SurpriseShopJoinListModel(dic:dic ))
                }
                
                
            }
            
 
        }else{
        
            super.setValue(value, forKey: key)

        }
        
    }
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) {
        
        
    }

    
    //在swift中想要打印对象要以下重写属性
    override var description: String{
        let keys = ["complete_time","od_no","join_list","od_count","lucky_nums","detail_url","goods_image","goods_name","od_goods_price","od_addtime","od_remain_count","od_buy_count","od_state","publish_time","od_type","buy_limit","share_data","app_qrimg","od_progress","prize_code","goods_id","have_address","od_id","member_name","member_avatar_url","buy_count","publish_date","member_ip","member_id","province"]
        let dic = dictionaryWithValues(forKeys: keys)
        return "\(dic)"
    }

}
